import {Input} from 'antd';
import * as moment from 'moment';

export const searchForm: any[] = [{
    key: 'nick_name',
    Component: Input,
    label: '昵称',
    props: {
        placeholder: '请输入昵称查询'
    }
}, {
    key: 'username',
    Component: Input,
    label: '用户名',
    props: {
        type: 'text',
        placeholder: '请输入用户名查询'
    }
}, {
    key: 'phone',
    Component: Input,
    label: '电话号码',
    props: {
        placeholder: '请输入电话号码查询'
    }
},{
    key: 'provider',
    Component: Input,
    label: '第三方账户厂家',
    props: {
        placeholder: '请输入第三方账户厂家查询'
    }
},  {
    key: 'status',
    Component: 'Select',
    initialValue: '',
    selectList: [{
        value: '',
        name: '全部'
    }, {
        value: 'normal',
        name: '正常'
    }, {
        value: 'abnormal',
        name: '异常账户'
    }, {
        value: 'delete',
        name: '已删除'
    }],
    label: '用户状态',
    props: {
        placeholder: '选择用户状态'
    }
}, {
    key: 'type',
    Component: 'Select',
    initialValue: '',
    selectList: [{
        value: '',
        name: '全部'
    }, {
        value: 1,
        name: '围观群众'
    }, {
        value: 2,
        name: '创造者'
    }],
    label: '用户类型',
    props: {
        placeholder: '选择用户类型'
    }
}];


export const editForm = (vals: any) => {
    const {handleChange, action, url} = vals['avatar'];

    return [{
        key: 'username',
        Component: Input,
        label: '用户名',
        initialValue: vals['username'],
        props: {
            disabled: true,
            placeholder: '用户名'
        }
    }, {
        key: 'nick_name',
        Component: Input,
        label: '昵称',
        initialValue: vals['nick_name'],
        props: {
            type: 'text',
            placeholder: '请输入昵称'
        }
    }, {
        key: 'describ',
        Component: Input.TextArea,
        label: '个人简介',
        initialValue: vals['describ'],
        props: {
            type: 'text',
            autosize: {minRows: 5},
            placeholder: '请输入昵称'
        }
    }, {
        key: 'phone',
        Component: Input,
        label: '电话号码',
        initialValue: vals['phone'],
        props: {
            placeholder: '请输入电话号码'
        }
    }, {
        key: 'avatar',
        label: '头像',
        Component: 'Upload',
        props: {
            handleChange,
            action,
            maxLength: 1
        },
        fileList: [{
            uid: '1',
            status: 'done',
            url,
        }]
    }, {
        key: 'email',
        Component: Input,
        initialValue: vals['email'],
        label: '邮箱地址',
        props: {
            placeholder: '选择用户类型'
        }
    }, {
        key: 'coin',
        Component: Input,
        initialValue: vals['coin'],
        label: '软妹币',
        props: {
            placeholder: '选择输入软妹币',
            disabled: true
        }
    }, {
        key: 'level',
        Component: 'Select',
        initialValue: vals['level'] || 1,
        label: '用户级别',
        selectList: [{
            value: 'lv1',
            name: 'Lv1'
        }, {
            value: 'lv2',
            name: 'Lv2'
        }, {
            value: 'lv3',
            name: 'Lv3'
        }, {
            value: 'lv4',
            name: 'Lv4'
        }, {
            value: 'lv5',
            name: 'Lv5'
        }, {
            value: 'lv6',
            name: 'Lv6'
        }, {
            value: 'lv7',
            name: 'Lv7'
        }, {
            value: 'lv8',
            name: 'Lv8'
        }, {
            value: 'lv9',
            name: 'Lv9'
        }, {
            value: 'lv10',
            name: 'Lv10'
        }, {
            value: 'lv11',
            name: 'Lv11'
        }, {
            value: 'lv12',
            name: 'Lv12'
        }],
        props: {
            disabled: true,
            placeholder: '选择用户级别'
        }
    }, {
        key: 'jobs',
        Component: Input,
        initialValue: vals['jobs'],
        label: '工作信息',
        props: {
            placeholder: '输入工作信息'
        }
    }, {
        key: 'status',
        Component: 'Select',
        initialValue: vals['status'],
        label: '用户状态',
        selectList: [{
            value: 'normal',
            name: '正常'
        }, {
            value: 'abnormal',
            name: '异常账户'
        }, {
            value: 'delete',
            name: '已删除'
        }],
        props: {
            placeholder: '选择用户状态',
        }
    }, {
        key: 'type',
        Component: 'Select',
        initialValue: vals['type'],
        selectList: [{
            value: 'ordinary',
            name: '围观群众'
        }, {
            value: 'creator',
            name: '创造者'
        }],
        label: '用户类型',
        props: {
            placeholder: '选择用户类型'
        }
    }, {
        key: 'system_update_time',
        Component: Input,
        initialValue: vals['system_update_time'] ? moment(vals['system_update_time']).format('YYYY-MM-DD HH:mm:ss') : '',
        label: '管理系统最后一次更新时间',
        props: {
            disabled: true
        }
    }, {
        key: 'add_time',
        Component: Input,
        initialValue: vals['add_time'] ? moment(vals['add_time']).format('YYYY-MM-DD HH:mm:ss') : '',
        label: '用户注册时间',
        props: {
            disabled: true
        }
    }, {
        key: 'update_time',
        Component: Input,
        initialValue: vals['update_time'] ? moment(vals['update_time']).format('YYYY-MM-DD HH:mm:ss') : '',
        label: '用户自己最后一次更新时间',
        props: {
            disabled: true
        }
    }]
}